import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserEvaluateVO, UserEvaluateForm, UserEvaluateQuery } from '@/api/system/userEvaluate/types';

/**
 * 查询用户评价信息列表
 * @param query
 * @returns {*}
 */

export const listUserEvaluate = (query?: UserEvaluateQuery): AxiosPromise<UserEvaluateVO[]> => {
  return request({
    url: '/system/userEvaluate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户评价信息详细
 * @param evaluateUserId
 */
export const getUserEvaluate = (evaluateUserId: string | number): AxiosPromise<UserEvaluateVO> => {
  return request({
    url: '/system/userEvaluate/' + evaluateUserId,
    method: 'get'
  });
};

/**
 * 新增用户评价信息
 * @param data
 */
export const addUserEvaluate = (data: UserEvaluateForm) => {
  return request({
    url: '/system/userEvaluate',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户评价信息
 * @param data
 */
export const updateUserEvaluate = (data: UserEvaluateForm) => {
  return request({
    url: '/system/userEvaluate',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户评价信息
 * @param evaluateUserId
 */
export const delUserEvaluate = (evaluateUserId: string | number | Array<string | number>) => {
  return request({
    url: '/system/userEvaluate/' + evaluateUserId,
    method: 'delete'
  });
};
